#include <dolphin/socket.h>
int SOWrite ( int s, const void* buf, int len );
int SOSend ( int s, const void* buf, int len, int flags );
int SOSendTo ( int s, const void* buf, int len, int flags,
const void* sockTo );
SOWrite(), SOSend() and SOSendTo() send a message through the specified socket.
SOWrite() is equivalent to SOSend() with no flags
set.
SOWrite(), SOSend() and SOSendTo() block
if space is not available at the sending socket's send buffer, unless the socket
descriptor is set to the nonblocking mode with SOFcntl()
(or
SO_MSG_DONTWAIT flag is specified) .
Note: The GameCube socket library employs Berkeley interpretation for the TCP urgent pointer: The TCP urgent pointer points to the byte next to the urgent byte.
s |
The socket descriptor. | ||||
buf |
A pointer to the buffer containing the message to send. | ||||
len |
The length of the message to be sent in bytes. If the message is too
long to pass through the underlying protocol, SOSend()
fails and no data is transmitted. |
||||
flags |
The type of message transmission: the flags are formed by logically
OR'ing zero or more of the following values (SO_SOCK_STREAM stream socket only):
|
||||
sockTo |
A pointer to a socket address structure containing the destination address. If the socket is connectionless-mode, SOSendTo()
sends the message to the address specified by sockTo.
If the socket is connection-mode, sockTo is
ignored. |
| non-negative | The number of bytes sent. If SO_O_NONBLOCK is set for the
socket descriptor, the return value can be smaller than len
(short count). |
SO_EAGAIN |
SO_O_NONBLOCK is set for the socket descriptor (or
SO_MSG_DONTWAIT flag is specified) and there is
no space in the send buffer to copy the message. |
SO_EAFNOSUPPORT |
Non-supported address family. |
SO_EBADF |
Bad socket descriptor. |
SO_ECONNRESET |
Connection reset. |
SO_EDESTADDRREQ |
No destination address was specified. |
SO_EINTR |
Canceled. |
SO_EINVAL |
Invalid operation. |
SO_EMSGSIZE |
Too large to be sent. |
SO_ENETDOWN |
Local network interface is down. |
SO_ENETRESET |
Socket library is not initialized. |
SO_ENETUNREACH |
Unreachable. |
SO_ENOBUFS |
Insufficient resources. |
SO_ENOTCONN |
Not connected. |
SO_EOPNOTSUPP |
Non-supported operation. |
SO_ETIMEDOUT |
Timed out. |
SO_EWOULDBLOCK |
Same as SO_EAGAIN. |
Note: Additional errors may be generated and returned in future library releases. All the negative return values must be treated as generic errors.